package com.dodayum;


import com.dodayum.action.DubboAction;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author DoDayum
 * @Date 2024-01-24-21:26
 */
public class Action extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        String pathInfo = req.getPathInfo();
        String response = "无返回";
        DubboAction dubboAction = new DubboAction();
        if("/getAllUrl".equals(pathInfo)){
             response = dubboAction.getAllUrl();
        } else if ("/deleteAllUrl".equals(pathInfo)) {
            dubboAction.deleteAll();
            response = "已全部删除";
        }

        System.out.println(pathInfo);
        resp.setContentType("text/html");
        resp.setCharacterEncoding("UTF-8");
        PrintWriter writer = resp.getWriter();
        writer.println(response);
    }
}
